// Get the query string in url.
function getQueryString(key) {
    var value = "";
    var queryStrings = window.document.location.search;
    if (queryStrings != "") {
        var arrayParams = queryStrings.substring(1).split("&");

        for (var i = 0; i < arrayParams.length; i++) {
            var param = arrayParams[i].split("=");
            if ((param[0] == key) && (param[1] != "")) {
                value = decodeURIComponent(param[1]);
                break;
            }
        }
    }
    return value;
}

String.prototype.trim = function() {
    return this.replace(/(^\s*)(\s*$)/g, '');
}
String.prototype.ltrim = function() {
    return this.replace(/(^\s*)/g, '');
}
String.prototype.rtrim = function() {
    return this.replace(/(\s*$)/g, '');
}